/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.zoio.saike.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.junit.Test;

import cn.org.rapid_framework.test.context.TestMethodContext;
import static junit.framework.Assert.*;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.zoio.saike.model.*;
import com.zoio.saike.dao.*;
import com.zoio.saike.service.*;
import com.zoio.saike.vo.query.*;

/**
 * @author Bryan@ZOIO.NET
 */


public class AmFileManagerTest extends BaseManagerTestCase{

	private AmFileManager manager;
	
	@Autowired
	public void setAmFileManager(AmFileManager manager) {
		this.manager = manager;
	}

    @Override
    protected String[] getDbUnitDataFiles() {
        //通过 TestMethodContext.getMethodName() 可以得到当前正在运行的测试方法名称
        return new String[]{"classpath:testdata/common.xml","classpath:testdata/AmFile.xml",
                            "classpath:testdata/AmFile_"+TestMethodContext.getMethodName()+".xml"};
    }

	//数据库单元测试前会开始事务，结束时会回滚事务，所以测试方法可以不用关心测试数据的删除
	@Test
	public void crud() {

		AmFile obj = newAmFile();
		manager.save(obj);
		manager.getEntityDao();
		
		manager.update(obj);
		manager.getEntityDao();
		
		assertNotNull(obj.getFileId());
		
		manager.removeById(new Integer(obj.getFileId()));
		manager.getEntityDao();
	
	}
	
	public static AmFile newAmFile() {
		AmFile obj = new AmFile();
		
	  	obj.setFileDate(new java.util.Date(System.currentTimeMillis()));
	  	obj.setCreatorId(new java.lang.String("1"));
	  	obj.setMiJiNo(new java.lang.String("1"));
	  	obj.setPersonName(new java.lang.String("1"));
	  	obj.setBoxNo(new java.lang.String("1"));
	  	obj.setStype(new java.lang.String("1"));
	  	obj.setPagesAmount(new java.lang.Integer("1"));
	  	obj.setUrgency(new java.lang.String("1"));
	  	obj.setIsLocked(new java.lang.Integer("1"));
	  	obj.setTextEntry(new java.lang.String("1"));
	  	obj.setCreateTime(new java.util.Date(System.currentTimeMillis()));
	  	obj.setBaoGuanQi(new java.lang.String("1"));
	  	obj.setVectorForm(new java.lang.String("1"));
	  	obj.setQuanZongNo(new java.lang.String("1"));
	  	obj.setJianNo(new java.lang.String("1"));
	  	obj.setZeRenZhe(new java.lang.String("1"));
	  	obj.setFenLeiNo(new java.lang.String("1"));
	  	obj.setInputPerson(new java.lang.String("1"));
	  	obj.setElectronicDoc(new java.lang.String("1"));
	  	obj.setJiNo(new java.lang.String("1"));
	  	obj.setModifyId(new java.lang.String("1"));
	  	obj.setFileTypeId(new java.lang.String("1"));
	  	obj.setMiJiSelect(new java.lang.String("1"));
	  	obj.setOrgId(new java.lang.String("1"));
	  	obj.setFileName(new java.lang.String("1"));
	  	obj.setDescription(new java.lang.String("1"));
	  	obj.setFenAmount(new java.lang.Integer("1"));
	  	obj.setAttachment(new java.lang.String("1"));
	  	obj.setCompanyId(new java.lang.String("1"));
	  	obj.setInputDate(new java.util.Date(System.currentTimeMillis()));
	  	obj.setModifyTime(new java.util.Date(System.currentTimeMillis()));
	  	obj.setArchiveYear(new java.lang.String("1"));
	  	obj.setSorder(new java.lang.Double("1"));
	  	obj.setIsValid(new java.lang.Integer("1"));
	  	obj.setFileType(new java.lang.Integer("1"));
	  	obj.setProcInstId(new java.lang.String("1"));
	  	obj.setNumberNo(new java.lang.String("1"));
	  	obj.setKeyword(new java.lang.String("1"));
	  	obj.setProcessDefId(new java.lang.String("1"));
	  	obj.setFormPath(new java.lang.String("1"));
		return obj;
	}
}
